package mobao.processor;

import com.netflix.zuul.FilterProcessor;
import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.context.RequestContext;
import com.netflix.zuul.exception.ZuulException;

/**
 * 用于拓展获取异常抛出属于哪个阶段
 * Created by yanghongquan on 2018/8/14 11:24
 */
public class DidiFilterProcessor extends FilterProcessor{

    @Override
    public  Object processZuulFilter(ZuulFilter filter) throws ZuulException{
        try {
            return super.processZuulFilter(filter);
        }catch (ZuulException e){
            RequestContext rtx = RequestContext.getCurrentContext();
            rtx.set("failed.filter",filter);
            throw e;
        }
    }

}
